import request from '@/request/request'

// 流程定义相关接口
export const workflowProcessApi = {
  // 分页查询流程定义
  list: (params) => request.get('/produce/workflow/process/list', { params }),
  
  // 根据ID查询流程定义
  getById: (id) => request.get(`/produce/workflow/process/getById/${id}`),
  
  // 新增流程定义
  add: (data) => request.post('/produce/workflow/process/add', data),
  
  // 更新流程定义
  update: (data) => request.put('/produce/workflow/process/update', data),
  
  // 删除流程定义
  delete: (id) => request.delete(`/produce/workflow/process/delete/${id}`),
  
  // 获取所有流程定义
  getAll: () => request.get('/produce/workflow/process/getAll')
}

// 流程任务相关接口
export const workflowTaskApi = {
  // 分页查询任务列表
  list: (params) => request.get('/produce/workflow/task/list', { params }),
  
  // 根据ID查询任务
  getById: (id) => request.get(`/produce/workflow/task/getById/${id}`),
  
  // 启动工作流
  start: (data) => request.post('/produce/workflow/task/start', data),
  
  // 审批任务
  approve: (data) => request.post('/produce/workflow/task/approve', data),
  
  // 撤回任务
  revoke: (data) => request.post('/produce/workflow/task/revoke', data),
  
  // 查询待办任务
  getTodoTasks: (assigneeId) => request.get(`/produce/workflow/task/todo/${assigneeId}`),
  
  // 查询已办任务
  getDoneTasks: (assigneeId) => request.get(`/produce/workflow/task/done/${assigneeId}`),
  
  // 根据单据查询任务
  getByBill: (billType, billId) => request.get('/produce/workflow/task/byBill', {
    params: { billType, billId }
  })
} 